﻿using System;
using System.Collections.Generic;
using System.Web;
using DataAccess;
using System.Data;

/// <summary>
/// Summary description for FacultyBS
/// </summary>
public class FacultyBS
{
    FacultyDAO F;
    ProfileTeachersDAO teacher;
    public FacultyBS()
    {
        F = new FacultyDAO();
        teacher = new ProfileTeachersDAO(); ;
        //
        // TODO: Add constructor logic here
        //
    }
    public string CodeFaculty(string NameFaculty)
    {
        string code = F.CodeFaculty(NameFaculty);
        return code;
    }
    public List<Faculty> ShowsFaculty()
    {
        DataTable tbl = F.ShowFaculty();
        List<Faculty> list = new List<Faculty>();
        foreach (DataRow row in tbl.Rows)
        {
            Faculty f = new Faculty(row[0].ToString(), row[1].ToString(), row[2].ToString());
            list.Add(f);
        }
        return list;
    }
    public int CodeProfileTeachers(string NameTeachers)
    {
        int code = teacher.CodeProfileTeachers(NameTeachers);
        return code;
    }
    public List<Teacher> ShowNameTeacher()
    {
        DataTable tbl = teacher.ShowNameTeacher();
        List<Teacher> list = new List<Teacher>();
        foreach (DataRow row in tbl.Rows)
        {
            Teacher f = new Teacher(int.Parse(row[0].ToString()), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), row[5].ToString(), row[6].ToString());
            list.Add(f);
        }
        return list;
    }
}